#include <stdio.h>
#include <arpa/inet.h>
int main()
{
    char temp[4] = {3, 4, 1, 2};
    int num = *(int *)temp;
    int sum = htonl(num);
    unsigned char *p = (unsigned char *)&sum;
    printf("%d %d %d %d\n", *p, *(p + 1), *(p + 2), *(p + 3));

    unsigned short a = 0x0102;
    unsigned short b = htons(a);
    printf("%x\n", b);
    return 0;
}